package com.example.demo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("orders")
public class Order {
    @TableId
    private String id;                    // 订单ID
    
    @TableField("order_number")
    private String orderNumber;           // 订单号
    
    @TableField("user_id")
    private Integer userId;              // 用户ID
    
    private String status;               // 订单状态：pending,paid,cancelled,refunded
    
    @TableField("total_amount")
    private BigDecimal totalAmount;      // 订单总金额
    
    @TableField("payment_method")
    private String paymentMethod;        // 支付方式：wechat, alipay
    
    @TableField("payment_order_id")
    private String paymentOrderId;      // 第三方支付订单号
    
    @TableField("paid_at")
    private LocalDateTime paidAt;       // 支付时间
    
    private String remark;               // 订单备注
    
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;
    
    @TableField(value = "updated_at", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;
}
